<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<!DOCTYPE html>
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>发布项目</title>
</head>
<body>
	<div class="heade-con">
		<div class="logo">
			<a href=""><img src="images/LOGO.png" /></a>
		</div>
		<div class="nav posa">
			<ul>
				<li><a class="vcolor" href="index.jsp">首页</a></li>
				<li><a href="gyzc-list.html">公益众筹</a></li>
				<li><a href="cop.html">常见问题</a></li>
				<li><a href="ly-list.html">众筹资讯</a></li>
				<!--  href="product/issue"  -->
				<li><a
				onclick="issue()"
				 >发布项目</a></li>
			</ul>
		</div>
		<div class="search">
			<form action="">
				<input type="text" class="search-txt" value="" placeholder="找项目">
				<input type="submit" class="search-but" value="">
			</form>
		</div>
		<div class="index-login">

			<c:choose>
				<c:when test="${user==null}">
					<a href="user/to/login">登录</a>
					<span style="color: white;">|</span>
					<a href="user/to/register">注册</a>
				</c:when>
				<c:when test="${user!=null}">
					<a href="sns/to/sns">${user.username }</a>
					<span style="color: red;">|</span>
					<a href="user/exit">退出</a>
				</c:when>
			</c:choose>

		</div>
	</div>
	
	<script type="text/javascript">
		//判断是否实名认证的事件	
		function issue(){
			$.ajax({
				type : 'POST',
				url : 'product/issue', 
				dataType : 'json',
				data : {

				},
				async : true,
				success : function(data) {
					if (data.code == 101) {
						alert("用户未登录");
						window.location.href="/Crowdfunding/user/to/login";
					} else if (data.code == 102) {
						alert("用户未实名认证,到个人中心实名认证");
					} else if (data.code == 103) {
						alert("实名认证审核中,无法发布项目");
					} else if (data.code == 105) {
						alert("实名认证审核失败,请到个人中心实名认证再次认证");
						/* window.location.href="/Crowdfunding/sns/to/certification"; */
					}else if (data.code == 104) {
						window.location.href="/Crowdfunding/product/to/basic";
					} else{
						 window.location.href="/Crowdfunding/product/to/basic";
					} 
				},
				error : function(msg) {
					alert("网络异常,发布项目失败");
				}
			});

		}
	
	</script>
	
</body>
</html>